' ++++++++++++++++++++++++++++ Klasa Apartment ++++++++++++++++++++++++

Public Class Apartment
  Inherits Building
  Implements ISnowRemoval      ' Tutaj "podpisujemy umow" z VB .NET...

  Private mUnits As Integer    ' Liczba mieszka
  Private mRent As Double      ' Cena najmu jednostki
  Private mOccupRate As Double ' Wspczynnik zajcia budynkw

  Public Sub New()

  End Sub

  ' Konstruktor z inicjalizujc list argumentw
  Public Sub New(ByVal Addr As String, ByVal Price As Double, _
            ByVal Payment As Double, ByVal Taxes As Double, _
            ByVal Bldg As Integer, ByVal SnowPhone As String)
    MyBase.Address = Addr
    MyBase.PurchasePrice = Price
    MyBase.MonthlyPayment = Payment
    MyBase.Taxes = Taxes
    MyBase.BuildingType = Bldg
    If SnowPhone = "" Then
      MyBase.SnowRemoval = APTPHONE
    Else
      MyBase.SnowRemoval = SnowPhone
    End If
  End Sub
  ' ==================== Waciwoci ======================

  Public Property Units() As Integer   ' Liczba mieszka
    Get
      Return mUnits
    End Get
    Set(ByVal Value As Integer)
      mUnits = Value
    End Set
  End Property

  Public Property Rents() As Double   ' Cena najmu
    Get
      Return mRent
    End Get
    Set(ByVal Value As Double)
      mRent = Value
    End Set
  End Property

  Public Property OccupancyRate() As Double ' Wspczynnik zajcia
    Get
      Return mOccupRate
    End Get
    Set(ByVal Value As Double)
      mOccupRate = Value
    End Set
  End Property

  ' ============== Metody ==================

  ' Tutaj wypeniamy nasz umow z Visual Basic .NET...
  Public Function CallSnowRemoval() As String Implements _
                    ISnowRemoval.CallSnowRemoval
    ' Cel: ta procedura jest wywoywana, aby usun nieg przed blokiem.
    '    
    Return "Apartment snow removal: " & MyBase.SnowRemoval
  End Function

  Public Sub DisplayBuilding()

    DisplayBaseInfo()
    Console.WriteLine("Apartment members:")
    Console.WriteLine("Number of Units: " & mUnits)
    Console.WriteLine("Rent per Unit: " & FormatMoney(mRent))
    Console.WriteLine("Occupancy Rate: " & mOccupRate)
  End Sub
End Class
